!function (window) {
    window.YDUI={};
    var doc = window.document,
        ydui = window.YDUI,
        ua = window.navigator && window.navigator.userAgent || ''; 
    var ipad = !!ua.match(/(iPad).*OS\s([\d_]+)/),
        ipod = !!ua.match(/(iPod)(.*OS\s([\d_]+))?/),
        iphone = !ipad && !!ua.match(/(iPhone\sOS)\s([\d_]+)/); 
        ydui.device = {
        isMobile: !!ua.match(/AppleWebKit.*Mobile.*/) || 'ontouchstart' in doc.documentElement,
        isIOS: !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
        isAndroid: !!ua.match(/(Android);?[\s\/]+([\d.]+)?/),
        isIpad: ipad,
        isIpod: ipod,
        isIphone: iphone,
        isWebView: (iphone || ipad || ipod) && !!ua.match(/.*AppleWebKit(?!.*Safari)/i),
        isWeixin: ua.indexOf('MicroMessenger') > -1,
        isMozilla: /firefox/.test(navigator.userAgent.toLowerCase()),
        pixelRatio: window.devicePixelRatio || 1,        
    };
}(window);